Optimal. Leaf size=101 \[ \frac {a^2 (A b-a B) \log (a+b \tan (c+d x))}{b^2 d \left (a^2+b^2\right )}-\frac {(A b-a B) \log (\cos (c+d x))}{d \left (a^2+b^2\right )}-\frac {x (a A+b B)}{a^2+b^2}+\frac {B \tan (c+d x)}{b d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.20, antiderivative size = 101, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3606, 3626, 3617, 31, 3475} \[ \frac {a^2 (A b-a B) \log (a+b \tan (c+d x))}{b^2 d \left (a^2+b^2\right )}-\frac {(A b-a B) \log (\cos (c+d x))}{d \left (a^2+b^2\right )}-\frac {x (a A+b B)}{a^2+b^2}+\frac {B \tan (c+d x)}{b d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 3475
Rule 3606
Rule 3617
Rule 3626
Rubi steps
\begin {align*} \int \frac {\tan ^2(c+d x) (A+B \tan (c+d x))}{a+b \tan (c+d x)} \, dx &=\frac {B \tan (c+d x)}{b d}+\frac {\int \frac {-a B-b B \tan (c+d x)+(A b-a B) \tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b}\\ &=-\frac {(a A+b B) x}{a^2+b^2}+\frac {B \tan (c+d x)}{b d}+\frac {(A b-a B) \int \tan (c+d x) \, dx}{a^2+b^2}+\frac {\left (a^2 (A b-a B)\right ) \int \frac {1+\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b \left (a^2+b^2\right )}\\ &=-\frac {(a A+b B) x}{a^2+b^2}-\frac {(A b-a B) \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {B \tan (c+d x)}{b d}+\frac {\left (a^2 (A b-a B)\right ) \operatorname {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \tan (c+d x)\right )}{b^2 \left (a^2+b^2\right ) d}\\ &=-\frac {(a A+b B) x}{a^2+b^2}-\frac {(A b-a B) \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {a^2 (A b-a B) \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right ) d}+\frac {B \tan (c+d x)}{b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 0.59, size = 118, normalized size = 1.17 \[ \frac {\frac {2 a^2 (A b-a B) \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right )}+\frac {i (A+i B) \log (-\tan (c+d x)+i)}{a+i b}-\frac {(B+i A) \log (\tan (c+d x)+i)}{a-i b}+\frac {2 B \tan (c+d x)}{b}}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.84, size = 149, normalized size = 1.48 \[ -\frac {2 \, {\left (A a b^{2} + B b^{3}\right )} d x + {\left (B a^{3} - A a^{2} b\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (B a^{3} - A a^{2} b + B a b^{2} - A b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (B a^{2} b + B b^{3}\right )} \tan \left (d x + c\right )}{2 \, {\left (a^{2} b^{2} + b^{4}\right )} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.59, size = 110, normalized size = 1.09 \[ -\frac {\frac {2 \, {\left (A a + B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {{\left (B a - A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{3} - A a^{2} b\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b^{2} + b^{4}} - \frac {2 \, B \tan \left (d x + c\right )}{b}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.22, size = 179, normalized size = 1.77 \[ \frac {B \tan \left (d x +c \right )}{b d}+\frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right ) A}{d b \left (a^{2}+b^{2}\right )}-\frac {a^{3} B \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{2} \left (a^{2}+b^{2}\right ) d}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) A b}{2 d \left (a^{2}+b^{2}\right )}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a B}{2 d \left (a^{2}+b^{2}\right )}-\frac {A \arctan \left (\tan \left (d x +c \right )\right ) a}{d \left (a^{2}+b^{2}\right )}-\frac {B \arctan \left (\tan \left (d x +c \right )\right ) b}{d \left (a^{2}+b^{2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.99, size = 109, normalized size = 1.08 \[ -\frac {\frac {2 \, {\left (A a + B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{3} - A a^{2} b\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b^{2} + b^{4}} + \frac {{\left (B a - A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, B \tan \left (d x + c\right )}{b}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.41, size = 117, normalized size = 1.16 \[ \frac {B\,\mathrm {tan}\left (c+d\,x\right )}{b\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{2\,d\,\left (b+a\,1{}\mathrm {i}\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,a^3-A\,a^2\,b\right )}{d\,\left (a^2\,b^2+b^4\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-B+A\,1{}\mathrm {i}\right )}{2\,d\,\left (a+b\,1{}\mathrm {i}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.53, size = 1015, normalized size = 10.05 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________